<?php
	// SimNet is a Second Life(tm) sim mangement tool that was designed for Fermi Sandbox
    // Copyright (C) 2011 Arthur Fermi
	// 
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License.
	// 
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
	//
	// To receive a copy of this license please visit http://www.gnu.org/licenses/
	
	// URL Format
	//http://<url>/simnet/simnet_verify.php?VerifyWho=Arthur%20Fermi

	//Set Variables
	$VerifyWho = $_GET['VerifyWho'];
	$file;
	$fileCN = "simnet_toolbar.cn";
	$fileMGRList = "simnet_managers.lst";
	$fileVersion = "simnet_toolbar.ver";
	$rndNum1 = rand (-100000, 100000);
	$rndNum2 = rand (-1000000, 1000000);
	$pos;
	$VerificationResult;
	$Channel;
	$Version;
	$ResultString;

	// Get comm channel
	$file = fopen($fileCN, "r");
	$Channel = fread($file, 128);
	fclose($file);

	// Get Version
	$file = fopen($fileVersion, "r");
	$Version = fread($file, 128);
	fclose($file);

	// Verify User
	$file = file_get_contents($fileMGRList);
	$pos = strpos($file, $VerifyWho);

	if($pos === false) 
	{
		$VerificationResult = "0";
		$Channel = "0";
		$Version = "0";
	}
	else
	{
		$VerificationResult = "1";
	}

	$ResultString = $Channel . "^" . $VerificationResult . "^" . $rndNum1 . "^" . $rndNum2 . "^" . $Version;
	echo $ResultString;

?> 